﻿using RectanglesPractise;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Rectangles.Test
{
    [TestClass()]
    public class RectangleTest
    {
        [TestMethod()]
        public void EqualCompareToTest()
        {
            Rectangle target = new Rectangle(new Position(0, 0), 25, 24);
            Rectangle other = new Rectangle(new Position(0, 0), 25, 24);
            int expected = 0;
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CloneTest()
        {
            Rectangle target = new Rectangle(new Position(), 25, 24);
            object actual;
            actual = target.Clone();
            Assert.AreNotEqual(target, actual);
        }

        [TestMethod()]
        public void RectangleConstructorTest()
        {
            Rectangle target = new Rectangle();
            Assert.AreEqual(0, target.Position.X);
            Assert.AreEqual(0, target.Position.Y);
            Assert.AreEqual(0, target.Height);
            Assert.AreEqual(0, target.Width);
        }

        [TestMethod()]
        public void RectangleConstructorTest1()
        {
            Position position = new Position(1, 2);
            double width = 10;
            double height = 20;
            Rectangle target = new Rectangle(position, width, height);
            Assert.AreEqual(1, target.Position.X);
            Assert.AreEqual(2, target.Position.Y);
            Assert.AreEqual(20, target.Height);
            Assert.AreEqual(10, target.Width);
        }

        [TestMethod()]
        public void HeightTest()
        {
            Rectangle target = new Rectangle(); 
            double expected = 15; 
            double actual;
            target.Height = expected;
            actual = target.Height;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void PositionTest()
        {
            Rectangle target = new Rectangle();
            Position expected = new Position(12, 25);
            Position actual;
            target.Position = expected;
            actual = target.Position;
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(12, target.Position.X);
            Assert.AreEqual(25, target.Position.Y);
        }

        [TestMethod()]
        public void WidthTest()
        {
            Position position = new Position(1, 2);
            double width = 10;
            double height = 20;
            Rectangle target = new Rectangle(position, width, height);
            double expected = 23;
            double actual;
            target.Width = expected;
            actual = target.Width;
            Assert.AreEqual(expected, actual);
        }
    }
}
